#include<stdio.h>


FILE *inFilePtr,*inFilePtr2;

void f1(char *path)
{
    inFilePtr=fopen(path,"r");
    if(inFilePtr==NULL)
        printf("error\n");
    else
        printf("success\n");
}

void f2(char *file_path)
{
    if((inFilePtr2=fopen(file_path,"r"))==NULL)
    {
        printf("File could not be opened\n");
    }
}


int main(void)
{
    f1("11-6-29/.txt");
}

int main(void)
{
    DIR *dp;
    FILE *inFile;
    struct dirent *filename;
    char *fileString;
    int Count[10];
    if((dp=opendir("./data/forward"))==NULL)
    {
        printf("open dir error\n");
        exit(0);
    }
    while(filename=readdir(dp))
    {
        fileString=filename->d_name;
        if(strcmp(fileString,".")==0 || strcmp(fileString,"..")==0)
            continue;

        memset(Count,0,sizeof(&Count));
        printf("filename:%-10s\n",filename->d_name);

        char path[40]={0};
        strcat(path,"data/forward/");
        strcat(path,filename->d_name);
        printf("path:%s\n",path);
        /*
        if((inFile=fopen(filename->d_name,"r"))==NULL)
        {
            printf("open file error\n");
            exit(0);
        }/
        if((inFile=fopen("data/forward/.txt","r"))==NULL)
        {
            printf("open file error\n");
            exit(0);
        }
        int numCnt=0,S11_cnt=0;
        int i;
        char cTemp,cPre=0;
        while((cTemp=fgetc(inFile))!=EOF)
        {
            if(cTemp=='\n')
                continue;

            numCnt++;

            if(numCnt==11 && cTemp>'0')
            {
                if(S11_cnt>0)
                {
                    S11_cnt++;
                }
            }
            else if(numCnt==11 && cTemp=='0')
            {
                if(S11_cnt>0)
                {
                    for(i=2;i<10;i++)
                    {
                        if(S11_cnt>=i)
                        {
                            Count[i]++;
                        }
                    }
                    S11_cnt=0;
                }
            }
            if(numCnt==12 && cTemp=='1' && cPre=='1')
            {
                if(S11_cnt==0)
                {
                    S11_cnt=1;
                }
            }


            if(numCnt==16)
            {
                numCnt=0;
            }
            cPre=cTemp;
        }

        for(i=2;i<10;i++)
        {
            printf("\twhen %d: %d\n",i,Count[i]);
        }
    }
    closedir(dp);
    return 0;
}
*/

